<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	List<TblOaNotice> list = (List<TblOaNotice>)request.getAttribute("list");
	NoticeForm form = (NoticeForm)request.getAttribute("command");
	String isimportant = StringUtils.isNotBlank(form.getIsimportant())?form.getIsimportant():"";
	String istop = StringUtils.isNotBlank(form.getIstop())?form.getIstop():"";
	String group = StringUtils.isNotBlank(form.getGroup())?form.getGroup():Constants.NOTICE_GROUP_NOTICE;
	String title = StringUtils.isNotBlank(form.getTitle())?form.getTitle():"";
	String viceTitle = StringUtils.isNotBlank(form.getViceTitle())?form.getViceTitle():"";
	int colnum = 6;
	if(Constants.NOTICE_GROUP_NOTICE.equalsIgnoreCase(group)){
		colnum = 7;
	}
%>


<table class="tableList">

	<thead>
		<tr>
			<td colspan="7" style="width: 90%;">
				<div class="FormTools">
					<div>标题：
						<input id="keywords" type="text" name="keywords" class="search"
							placeholder="请输入标题关键字"
							value="<%=StringUtils.isNotBlank(form.getTitle())?form.getTitle():""%>" />
							<%if(Constants.NOTICE_GROUP_NOTICE.equalsIgnoreCase(group)){
								%>&nbsp;&nbsp; 副标题：<input id="viceTitle" type="text" name="viceTitle" class="search"placeholder="请输入标题关键字"
							value="<%=StringUtils.isNotBlank(form.getViceTitle())?form.getViceTitle():""%>" /><%
							} %>
						<input type="button" class="searchSubmit" value="搜索"
							onclick="javascript:XF.Notice.readListNoticeSearch('<%=group%>')" />
					</div>
				</div>
			</td>
		</tr>
	</thead>

	<tbody>
		<tr id="tableHeader">
			<%if(Constants.NOTICE_GROUP_NOTICE.equalsIgnoreCase(group)){
				%><th style="width: 6%;">文件编号</th><%
			} %>
			<th style="width: 20%;">标题</th>
			<%if(Constants.NOTICE_GROUP_NOTICE.equalsIgnoreCase(group)){
				%><th style="width: 18%;">副标题</th><%
			} %>
			<th style="width: 4%;">发布人</th>
			<th style="width: 10%;">发布部门</th>
			<th style="width: 10%;">接收区域</th>
			<th style="width: 10%;">发布时间</th>
		</tr>
		<%
          	if(null!=list && list.size()>0){
          		StringBuilder recRange = new StringBuilder();
          		for(TblOaNotice notice:list){
          			String id = EncrypTool.encode(notice.getNoticeId()+"");
          			recRange = new StringBuilder();
          			if("1".equals(notice.getToZB())){
          				recRange.append("广东区 ");
          			}
          			if("1".equals(notice.getToZJ())){
          				recRange.append("浙江区 ");
          			}
          			if("1".equals(notice.getToFJ())){
          				recRange.append("福建区");
          			}
          			%>
					<tr>
						<%if(Constants.NOTICE_GROUP_NOTICE.equalsIgnoreCase(group)){
							%><td><%=StringUtils.isNotBlank(notice.getDocNumber())?notice.getDocNumber():""%></td><%
						} %>
						<td style="text-align: left; padding-left: 10px;">
							<a href="javascript:XF.Notice.detail('<%=EncrypTool.encode(notice.getNoticeId()+"")%>','<%=title %>','<%=form.getPageNum()%>','<%=group%>')" >
							<p><%=notice.getIstop().equals("1")?"<span style='color: red;'>[置顶]</span> ":"" %><%=notice.getIsimportant().equals("1")?"<span style='color: red;'>[重要]</span> ":"" %><%=StringUtils.isNotBlank(notice.getTitle())?notice.getTitle():""%></p>
							</a>
						</td>
						<%if(Constants.NOTICE_GROUP_NOTICE.equalsIgnoreCase(group)){
							%><td><%=StringUtils.isNotBlank(notice.getViceTitle())?notice.getViceTitle():""%></td><%
						} %>
						<td><%=StringUtils.isNotBlank(notice.getPublicMan())?notice.getPublicMan():""%></td>
						<td><%=StringUtils.isNotBlank(notice.getPublicDepart())?notice.getPublicDepart():""%></td>
						<td><%=StringUtils.isNotBlank(recRange.toString())?recRange.toString():""%></td>
						<td><%=null!=notice.getPublicTime()?DateFormatUtils.format(notice.getPublicTime().getTime(), "yyyy-MM-dd HH:mm:ss"):"" %></td>
					</tr>
					<%
           		}
           	}
        %>
        
        <tr>
		<%
			for(int i=0;i<(colnum-1);i++){
				%><td style="height:0"/><%
			}
		%>
		</tr>
        
        		<tr id="tableFooter">
			<td colspan="<%=colnum%>">
				<div class="pagination">
					<monggoTag:pagination href="notice_search"
						pageSize="<%=form.getPageSize()%>"
						totalRecord="<%=form.getTotalRecord() %>"
						currentPage="<%=form.getPageNum() %>">
					</monggoTag:pagination>
				</div>
			</td>
		</tr>
	</tbody>
<%-- 	<tfoot>
		<tr id="tableFooter">
			<td colspan="4">
				<div class="pagination">
					<div style="width:1px">&nbsp;</div>
					<monggoTag:pagination href="notice_search"
						pageSize="<%=form.getPageSize()%>"
						totalRecord="<%=form.getTotalRecord() %>"
						currentPage="<%=form.getPageNum() %>">
					</monggoTag:pagination>
				</div>
			</td>
		</tr>
	</tfoot> --%>
</table>